# eric7.WebBrowser.OpenSearch.OpenSearchEngine

Module implementing the open search engine.

### Global Attributes

None

### Classes

OpenSearchEngine | Class implementing the open search engine.

### Functions

None

## OpenSearchEngine

Class implementing the open search engine.

### Signals

imageChanged()
  emitted after the icon has been changed
suggestions(list of strings)
  emitted after the suggestions have been received

### Derived from

QObject

### Class Attributes

None

### Class Methods

parseTemplate | Class method to parse a search template.

### Methods

OpenSearchEngine | Constructor
__eq__ | Special method implementing the == operator.
__imageObtained | Private slot to receive the image of the engine.
__lt__ | Special method implementing the < operator.
__suggestionsObtained | Private slot to receive the suggestions.
description | Public method to get the description of the engine.
image | Public method to get the image of the engine.
imageUrl | Public method to get the image URL of the engine.
isValid | Public method to check, if the engine is valid.
loadImage | Public method to load the image of the engine.
name | Public method to get the name of the engine.
networkAccessManager | Public method to get a reference to the network access manager object.
providesSuggestions | Public method to check, if the engine provides suggestions.
requestSuggestions | Public method to request suggestions.
searchMethod | Public method to get the HTTP request method used to perform search requests.
searchParameters | Public method to get the search parameters of the engine.
searchUrl | Public method to get a URL ready for searching.
searchUrlTemplate | Public method to get the search URL template of the engine.
setDescription | Public method to set the engine description.
setImage | Public method to set the image of the engine.
setImageUrl | Public method to set the engine image URL.
setImageUrlAndLoad | Public method to set the engine image URL.
setName | Public method to set the engine name.
setNetworkAccessManager | Public method to set the reference to the network access manager.
setSearchMethod | Public method to set the HTTP request method used to perform search requests.
setSearchParameters | Public method to set the engine search parameters.
setSearchUrlTemplate | Public method to set the engine search URL template.
setSuggestionsMethod | Public method to set the HTTP request method used to perform suggestions requests.
setSuggestionsParameters | Public method to set the engine suggestions parameters.
setSuggestionsUrlTemplate | Public method to set the engine suggestions URL template.
suggestionsMethod | Public method to get the HTTP request method used to perform suggestions requests.
suggestionsParameters | Public method to get the suggestions parameters of the engine.
suggestionsUrl | Public method to get a URL ready for suggestions.
suggestionsUrlTemplate | Public method to get the search URL template of the engine.

### Static Methods

None

#### OpenSearchEngine.parseTemplate (class method)

parseTemplate(searchTerm, searchTemplate)

Class method to parse a search template.

searchTerm (str)
  term to search for
searchTemplate (str)
  template to be parsed

Return:
  parsed template

Return Type:
  str

#### OpenSearchEngine (Constructor)

OpenSearchEngine(parent=None)

Constructor

parent (QObject)
  reference to the parent object

#### OpenSearchEngine.__eq__

__eq__(other)

Special method implementing the == operator.

other (OpenSearchEngine)
  reference to an open search engine

Return:
  flag indicating equality

Return Type:
  bool

#### OpenSearchEngine.__imageObtained

__imageObtained(reply)

Private slot to receive the image of the engine.

reply (QNetworkReply)
  reference to the network reply

#### OpenSearchEngine.__lt__

__lt__(other)

Special method implementing the < operator.

other (OpenSearchEngine)
  reference to an open search engine

Return:
  flag indicating less than

Return Type:
  bool

#### OpenSearchEngine.__suggestionsObtained

__suggestionsObtained()

Private slot to receive the suggestions.

#### OpenSearchEngine.description

description()

Public method to get the description of the engine.

Return:
  description of the engine

Return Type:
  str

#### OpenSearchEngine.image

image()

Public method to get the image of the engine.

Return:
  image of the engine

Return Type:
  QImage

#### OpenSearchEngine.imageUrl

imageUrl()

Public method to get the image URL of the engine.

Return:
  image URL of the engine

Return Type:
  str

#### OpenSearchEngine.isValid

isValid()

Public method to check, if the engine is valid.

Return:
  flag indicating validity

Return Type:
  bool

#### OpenSearchEngine.loadImage

loadImage()

Public method to load the image of the engine.

#### OpenSearchEngine.name

name()

Public method to get the name of the engine.

Return:
  name of the engine

Return Type:
  str

#### OpenSearchEngine.networkAccessManager

networkAccessManager()

Public method to get a reference to the network access manager object.

Return:
  reference to the network access manager object

Return Type:
  QNetworkAccessManager

#### OpenSearchEngine.providesSuggestions

providesSuggestions()

Public method to check, if the engine provides suggestions.

Return:
  flag indicating suggestions are provided

Return Type:
  bool

#### OpenSearchEngine.requestSuggestions

requestSuggestions(searchTerm)

Public method to request suggestions.

searchTerm (str)
  term to get suggestions for

#### OpenSearchEngine.searchMethod

searchMethod()

Public method to get the HTTP request method used to perform search requests.

Return:
  HTTP request method

Return Type:
  str

#### OpenSearchEngine.searchParameters

searchParameters()

Public method to get the search parameters of the engine.

Return:
  search parameters of the engine

Return Type:
  list of [tuple, tuple]

#### OpenSearchEngine.searchUrl

searchUrl(searchTerm)

Public method to get a URL ready for searching.

searchTerm (str)
  term to search for

Return:
  URL

Return Type:
  QUrl

#### OpenSearchEngine.searchUrlTemplate

searchUrlTemplate()

Public method to get the search URL template of the engine.

Return:
  search URL template of the engine

Return Type:
  str

#### OpenSearchEngine.setDescription

setDescription(description)

Public method to set the engine description.

description (str)
  description of the engine

#### OpenSearchEngine.setImage

setImage(image)

Public method to set the image of the engine.

image (QImage)
  image to be set

#### OpenSearchEngine.setImageUrl

setImageUrl(imageUrl)

Public method to set the engine image URL.

imageUrl (str)
  image URL of the engine

#### OpenSearchEngine.setImageUrlAndLoad

setImageUrlAndLoad(imageUrl)

Public method to set the engine image URL.

imageUrl (str)
  image URL of the engine

#### OpenSearchEngine.setName

setName(name)

Public method to set the engine name.

name (str)
  name of the engine

#### OpenSearchEngine.setNetworkAccessManager

setNetworkAccessManager(networkAccessManager)

Public method to set the reference to the network access manager.

networkAccessManager (QNetworkAccessManager)
  reference to the network access manager object

#### OpenSearchEngine.setSearchMethod

setSearchMethod(method)

Public method to set the HTTP request method used to perform search requests.

method (str)
  HTTP request method

#### OpenSearchEngine.setSearchParameters

setSearchParameters(searchParameters)

Public method to set the engine search parameters.

searchParameters (list of [tuple, tuple])
  search parameters of the engine

#### OpenSearchEngine.setSearchUrlTemplate

setSearchUrlTemplate(searchUrlTemplate)

Public method to set the engine search URL template.

The URL template is processed according to the specification: http://www.opensearch.org/Specifications/OpenSearch/1.1#OpenSearch_URL_template_syntax

A list of template parameters currently supported and what they are replaced with:

Parameter | Value
{count} | 20
{startIndex} | 0
{startPage} | 0
{language} | the default language code (RFC 3066)
{country} | the default country code (first part of language)
{inputEncoding} | UTF-8
{outputEncoding} | UTF-8
{searchTerms} | the string supplied by the user
{*:source} | application name, QCoreApplication::applicationName()

searchUrlTemplate (str)
  search URL template of the engine

#### OpenSearchEngine.setSuggestionsMethod

setSuggestionsMethod(method)

Public method to set the HTTP request method used to perform suggestions requests.

method (str)
  HTTP request method

#### OpenSearchEngine.setSuggestionsParameters

setSuggestionsParameters(suggestionsParameters)

Public method to set the engine suggestions parameters.

suggestionsParameters (list of [tuple, tuple])
  suggestions parameters of the engine

#### OpenSearchEngine.setSuggestionsUrlTemplate

setSuggestionsUrlTemplate(suggestionsUrlTemplate)

Public method to set the engine suggestions URL template.

suggestionsUrlTemplate (str)
  suggestions URL template of the engine

#### OpenSearchEngine.suggestionsMethod

suggestionsMethod()

Public method to get the HTTP request method used to perform suggestions requests.

Return:
  HTTP request method

Return Type:
  str

#### OpenSearchEngine.suggestionsParameters

suggestionsParameters()

Public method to get the suggestions parameters of the engine.

Return:
  suggestions parameters of the engine

Return Type:
  list of [tuple, tuple]

#### OpenSearchEngine.suggestionsUrl

suggestionsUrl(searchTerm)

Public method to get a URL ready for suggestions.

searchTerm (str)
  term to search for

Return:
  URL

Return Type:
  QUrl

#### OpenSearchEngine.suggestionsUrlTemplate

suggestionsUrlTemplate()

Public method to get the search URL template of the engine.

Return:
  search URL template of the engine

Return Type:
  str

Up